package com.naire.modul.answer_sort.action;

import java.util.ArrayList;
import java.util.List;

import net.common.action.GeneralAction;
import com.naire.modul.answer_sort.service.Answer_sortDeleteService;
import com.naire.modul.answer_sort.service.Answer_sortEditorService;
import com.naire.modul.answer_sort.service.Answer_sortFindService;
import com.naire.modul.answer_sort.service.Answer_sortSearchService;
import com.naire.modul.answer_sort.vo.Answer_sortVo;

public class Answer_sortAction extends GeneralAction {

	private static final long serialVersionUID = 7127573666355745443L;

	private Answer_sortVo bean = new Answer_sortVo();
	private List<Answer_sortVo> list = new ArrayList<Answer_sortVo>();
	private String parent_code;

	public void searchTree() throws Exception {
		Answer_sortSearchService service = new Answer_sortSearchService();
		service.setParent_code(parent_code);
		service.invoke();
		json(service.getList());
	}

	public String search() throws Exception {
		Answer_sortSearchService service = new Answer_sortSearchService();
		service.setPageBean(pageBean);
		service.setParent_code(parent_code);
		service.invoke();
		list = service.getList();
		return SUCCESS;
	}

	public String editor() throws Exception {
		Answer_sortEditorService service = new Answer_sortEditorService();
		service.setBean(bean);
		service.setParent_code(parent_code);
		service.invoke();
		return SUCCESS;
	}

	public String find() throws Exception {
		if (bean.getAnswer_sort_id() != null) {
			Answer_sortFindService service = new Answer_sortFindService();
			service.setId(bean.getAnswer_sort_id());
			service.invoke();
			bean = service.getBean();
		}
		return SUCCESS;
	}

	public String delete() throws Exception {
		Answer_sortDeleteService service = new Answer_sortDeleteService();
		service.setBean(bean);
		service.invoke();
		return SUCCESS;
	}

	public Answer_sortVo getBean() {
		return bean;
	}

	public void setBean(Answer_sortVo bean) {
		this.bean = bean;
	}

	public List<Answer_sortVo> getList() {
		return list;
	}

	public void setList(List<Answer_sortVo> list) {
		this.list = list;
	}

	public String getParent_code() {
		return parent_code;
	}

	public void setParent_code(String parent_code) {
		this.parent_code = parent_code;
	}
}
